package com.yhc.order.server.config;

import com.yhc.order.server.interceptor.UserInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * springboot拦截器配置
 *
 * @author yhc
 * @date 2021-1-8
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Resource
    UserInterceptor userInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(userInterceptor).excludePathPatterns("/error");
    }

}
